package com.sleep.model;

import javax.persistence.*;
import java.sql.Date;

/**
 * Created by fadinglan on 2017/4/10.
 */
@Entity
@Table(name = "sleep_data", schema = "teenagers_monitor", catalog = "")
public class SleepDataEntity {
    private int iSleepId;
    private String vcDeviceId;
    private String mtBreathRate;
    private String mtHeartRate;
    private String mtMove;
    private Date tStartTime;
    private Date tEndTime;

    @Id
    @Column(name = "i_sleep_id", nullable = false)
    public int getiSleepId() {
        return iSleepId;
    }

    public void setiSleepId(int iSleepId) {
        this.iSleepId = iSleepId;
    }

    @Basic
    @Column(name = "vc_device_id", nullable = false, length = 20)
    public String getVcDeviceId() {
        return vcDeviceId;
    }

    public void setVcDeviceId(String vcDeviceId) {
        this.vcDeviceId = vcDeviceId;
    }

    @Basic
    @Column(name = "mt_breath_rate", nullable = true, length = -1)
    public String getMtBreathRate() {
        return mtBreathRate;
    }

    public void setMtBreathRate(String mtBreathRate) {
        this.mtBreathRate = mtBreathRate;
    }

    @Basic
    @Column(name = "mt_heart_rate", nullable = true, length = -1)
    public String getMtHeartRate() {
        return mtHeartRate;
    }

    public void setMtHeartRate(String mtHeartRate) {
        this.mtHeartRate = mtHeartRate;
    }

    @Basic
    @Column(name = "mt_move", nullable = true, length = -1)
    public String getMtMove() {
        return mtMove;
    }

    public void setMtMove(String mtMove) {
        this.mtMove = mtMove;
    }

    @Basic
    @Column(name = "t_start_time", nullable = true)
    public Date gettStartTime() {
        return tStartTime;
    }

    public void settStartTime(Date tStartTime) {
        this.tStartTime = tStartTime;
    }

    @Basic
    @Column(name = "t_end_time", nullable = true)
    public Date gettEndTime() {
        return tEndTime;
    }

    public void settEndTime(Date tEndTime) {
        this.tEndTime = tEndTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SleepDataEntity that = (SleepDataEntity) o;

        if (iSleepId != that.iSleepId) return false;
        if (vcDeviceId != null ? !vcDeviceId.equals(that.vcDeviceId) : that.vcDeviceId != null) return false;
        if (mtBreathRate != null ? !mtBreathRate.equals(that.mtBreathRate) : that.mtBreathRate != null) return false;
        if (mtHeartRate != null ? !mtHeartRate.equals(that.mtHeartRate) : that.mtHeartRate != null) return false;
        if (mtMove != null ? !mtMove.equals(that.mtMove) : that.mtMove != null) return false;
        if (tStartTime != null ? !tStartTime.equals(that.tStartTime) : that.tStartTime != null) return false;
        if (tEndTime != null ? !tEndTime.equals(that.tEndTime) : that.tEndTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = iSleepId;
        result = 31 * result + (vcDeviceId != null ? vcDeviceId.hashCode() : 0);
        result = 31 * result + (mtBreathRate != null ? mtBreathRate.hashCode() : 0);
        result = 31 * result + (mtHeartRate != null ? mtHeartRate.hashCode() : 0);
        result = 31 * result + (mtMove != null ? mtMove.hashCode() : 0);
        result = 31 * result + (tStartTime != null ? tStartTime.hashCode() : 0);
        result = 31 * result + (tEndTime != null ? tEndTime.hashCode() : 0);
        return result;
    }
}
